
package com.kweative.model.test.model;

import com.kweative.model.Entity;
import com.kweative.model.apt.annotation.TableDeclaration;
import com.kweative.model.exception.StructureException;
import com.kweative.model.column.ColumnBoolean;
import com.kweative.model.column.ColumnCreated;
import com.kweative.model.column.ColumnInteger;
import com.kweative.model.column.ColumnText;
import com.kweative.model.relation.RelationOne2Many;

/**
 *
 * @author henrik
 */
@TableDeclaration
public class Article extends Entity<ArticleRow,Article,BasicSchema> {
    public ColumnText<Article> Title;
    public ColumnText<Article> Teaser;
    public ColumnText<Article> Body;
    public ColumnBoolean<Article> Published;
    public ColumnCreated<Article> Created;
    public ColumnInteger<Article> Prio;

    public RelationOne2Many<User,Article> User;
    
    @Override
    protected void makeStructure() throws StructureException {
        Title = addColumn(new ColumnText<Article>(ColumnText.Size.TITLE));
        Teaser = addColumn(new ColumnText<Article>(ColumnText.Size.TEASER));
		Created = addColumn(new ColumnCreated());
        Body = addColumn(new ColumnText<Article>(ColumnText.Size.BODY));
        Published = addColumn(new ColumnBoolean());
        Prio = addColumn(new ColumnInteger());

		
        User = addRelation(new RelationOne2Many<User,Article>(getSchema().User));
    }

}
